package com.qinggeng.project.system.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.qinggeng.framework.aspectj.lang.annotation.Log;
import com.qinggeng.framework.aspectj.lang.enums.BusinessType;
import com.qinggeng.project.system.domain.JobInfoCollect;
import com.qinggeng.project.system.service.IJobInfoCollectService;
import com.qinggeng.framework.web.controller.BaseController;
import com.qinggeng.framework.web.domain.AjaxResult;
import com.qinggeng.common.utils.poi.ExcelUtil;
import com.qinggeng.framework.web.page.TableDataInfo;
/**
 * 招聘信息收藏Controller
 *
 * @author smallfish
 * @date 2020-12-24
 */
@RestController
@RequestMapping("/system/jobInfoCollect")
public class JobInfoCollectController extends BaseController
{
    @Autowired
    private IJobInfoCollectService jobInfoCollectService;

    /**
     * 查询招聘信息收藏列表
     */
    @PreAuthorize("@ss.hasPermi('system:jobInfoCollect:list')")
    @GetMapping("/list")
    public TableDataInfo list(JobInfoCollect jobInfoCollect)
    {
        startPage();
        List<JobInfoCollect> list = jobInfoCollectService.listJobInfoCollect(jobInfoCollect);
        return getDataTable(list);
    }

    /**
     * 导出招聘信息收藏列表
     */
    @PreAuthorize("@ss.hasPermi('system:jobInfoCollect:export')")
    @Log(title = "招聘信息收藏", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(JobInfoCollect jobInfoCollect)
    {
        List<JobInfoCollect> list = jobInfoCollectService.listJobInfoCollect(jobInfoCollect);
        ExcelUtil<JobInfoCollect> util = new ExcelUtil<JobInfoCollect>(JobInfoCollect.class);
        return util.exportExcel(list, "jobInfoCollect");
    }

    /**
     * 获取招聘信息收藏详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:jobInfoCollect:query')")
    @GetMapping(value = "/{collectId}")
    public AjaxResult getInfo(@PathVariable("collectId") Long collectId)
    {
        return AjaxResult.success(jobInfoCollectService.selectJobInfoCollectById(collectId));
    }

    /**
     * 新增招聘信息收藏
     */
    @PreAuthorize("@ss.hasPermi('system:jobInfoCollect:add')")
    @Log(title = "招聘信息收藏", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody JobInfoCollect jobInfoCollect)
    {
        return toAjax(jobInfoCollectService.insertJobInfoCollect(jobInfoCollect));
    }

    /**
     * 修改招聘信息收藏
     */
    @PreAuthorize("@ss.hasPermi('system:jobInfoCollect:edit')")
    @Log(title = "招聘信息收藏", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody JobInfoCollect jobInfoCollect)
    {
        return toAjax(jobInfoCollectService.updateJobInfoCollect(jobInfoCollect));
    }

    /**
     * 删除招聘信息收藏
     */
    @PreAuthorize("@ss.hasPermi('system:jobInfoCollect:remove')")
    @Log(title = "招聘信息收藏", businessType = BusinessType.DELETE)
	@DeleteMapping("/{collectIds}")
    public AjaxResult remove(@PathVariable Long[] collectIds)
    {
        return toAjax(jobInfoCollectService.deleteJobInfoCollectByIds(collectIds));
    }
}
